<template>
  <div class="">
    <div class="tag-group flex">
      <div class="title text-A3A3A3 font-normal flex items-start mr-12px" :style="titleStyle">
        <span class="pt-5px pb-5px">{{ title }}</span>
      </div>
      <div class="tags flex-1 flex flex-wrap">
        <div
          v-for="item in data"
          :key="item.value"
          class="item text-333 font-normal flex-center"
          :class="id == item.value ? 'active' : 'noactive'"
          @click="click(item)"
        >
          <span>{{ item.label }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String
    }, // 标题
    titleStyle: {
      type: String,
      default: ''
    },
    data: {
      type: Array,
      default: () => []
    }, // 数据
    id: {
      type: String
    } // 被选中
  },
  methods: {
    click(item) {
      this.$emit('on-click', item)
    }
  }
}
</script>

<style lang="scss" scoped>
.tag-group {
  .title {
    font-size: 18px;
  }

  .tags {
    .item {
      font-size: 16px;
      margin-right: 12px;
      margin-bottom: 20px;
    }
  }
}

.textAlign {
  text-align: justify;
  width: 60px;
  height: 27px;
  margin-top: 3px;
  span {
    display: inline-block;
    padding-left: 100%;
  }
}

.noactive {
  height: 34px;
  background: rgba(246, 246, 246, 1);
  border-radius: 35px 35px 35px 35px;
  border: 1px solid #f6f6f6;
  padding-top: 6px;
  padding-bottom: 6px;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
}

.active {
  height: 34px;
  background: #eef9ff;
  border-radius: 35px 35px 35px 35px;
  border: 1px solid #51c3ff;
  margin-right: 12px;
  padding-top: 6px;
  padding-bottom: 6px;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
  color: #51c3ff;
}
</style>
